<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
      <el-form-item label="一级分类" prop="firstclass">
        <el-input
          v-model="queryParams.firstclass"
          placeholder="漫画"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="二级分类" prop="courselev">
        <!-- <el-input
          v-model="queryParams.courselev"
          placeholder="高级班"
          clearable
          @keyup.enter.native="handleQuery"
        /> -->
            <template>
              <el-dropdown trigger="click" @command="handleCommand">
                    <el-button type="primary">
                      {{ selectLv }} <i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item command="基础班">基础班</el-dropdown-item>
                        <el-dropdown-item command="提升班">提升班</el-dropdown-item>
                        <el-dropdown-item command="高级班">高级班</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
            </template>
      </el-form-item>
      <el-form-item label="课程名称" prop="coursename">
        <el-input
          v-model="queryParams.coursename"
          placeholder="请输入课程名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
    
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:courses:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:courses:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:courses:remove']"
        >删除</el-button>
      </el-col>
      <!-- <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:courses:export']"
        >导出</el-button>
      </el-col> -->
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="coursesList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="ID" width="55" align="center" prop="id" />
      <el-table-column label="一级分类" align="center" prop="firstclass" />
      <el-table-column label="二级分类" align="center" prop="courselev" />
      <el-table-column label="课程名称" align="center" prop="coursename" />
      <el-table-column label="课程介绍" align="center" prop="courseins" />
      <el-table-column label="课程图集" align="center" prop="coursephotosList">
        <template slot-scope="scope">
          <div style="display: flex; flex-direction:row; justify-content:center; align-items:center;">
              <div v-if="scope.row.coursephotosList!=null && scope.row.coursephotosList!=''" style="display: flex; flex-direction:row; justify-content:center; align-items:center;">
                <img v-for="item in showimg(scope.row.coursephotosList)" :src="item" style="width:38px;height:38px;padding:2px;border:1px solid #999; margin-right:2px;"></img>
              </div>  
            </div>
        </template>
      </el-table-column>
      <el-table-column label="招生对象" align="center" prop="courseobj" />
      <el-table-column label="人数/班" align="center" prop="coursepeople" />
      <el-table-column label="课程时间" align="center" prop="coursetime" />
      <el-table-column label="总课数(节)" align="center" prop="totalcourses" />
      <el-table-column label="开始时间" align="center" prop="starttime">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.starttime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="结束时间" align="center" prop="endtime">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.endtime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="星期" align="center" prop="weekname" />
      <el-table-column label="描述" align="center" prop="classtime" />
      <el-table-column label="课程价格" align="center" prop="courseprice" />
      <el-table-column label="状态" align="center" prop="coursestate">
        <template slot-scope="scope">
          <el-tag type="success" v-if="scope.row.coursestate===1">正常</el-tag>
          <el-tag type="danger" v-if="scope.row.coursestate===0">已下架</el-tag>
        </template>
        
      </el-table-column>
      <el-table-column label="过期" align="center" prop="expiredday" />
      <el-table-column label="创建时间" align="center" prop="createtime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createtime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:courses:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:courses:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />




    
    <!-- 添加或修改【请填写功能名称】对话框 -->
    <!--
      :auto-upload="false" //auto=false情况不需要下面的三个参数， axios有自定then返回
      :on-preview="handlePreview"
      :on-remove="handleRemove"
      :on-success="handleFileSuccess"
      --->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-form-item label="一级分类" prop="firstclass">
          <el-input v-model="form.firstclass" placeholder="一级分类：漫画" />
        </el-form-item>
        <el-form-item label="二级分类" prop="courselev">
               <el-dropdown trigger="click" @command="handleCommandAdd">
                    <el-button type="primary">
                      {{ selectCourse }} <i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item :command="item" v-for="item in objArr">{{ item }}</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
        </el-form-item>
        <el-form-item label="课程名称" prop="coursename">
          <el-input v-model="form.coursename" placeholder="请输入课程名称" />
        </el-form-item>
        <el-form-item label="课程介绍" prop="courseins">
          <el-input v-model="form.courseins" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="课程海报">
          <!-- <el-radio v-model="radio" label="1" @input="selectRadio">本地上传</el-radio>
          <el-radio v-model="radio" label="2" @input="selectRadio">网络地址</el-radio> -->
            <el-upload ref="field101"
              multiple
              action="#"
              :on-change="handleFileChange"
              :before-remove="handleFileRemove"
              list-type="picture"
              :file-list="upload.fileList" 
              :auto-upload="false"
              :before-upload="field101BeforeUpload">
              <el-button size="small" type="primary" icon="el-icon-upload" v-hasPermi="['system:courses:upload']">点击上传 (支持多图) </el-button>
            </el-upload>
        </el-form-item>
        <el-form-item label="招生对象" prop="courseobj">
                <el-dropdown trigger="click" @command="handleZSCommand">
                    <el-button type="primary">
                      {{ selectObj }} <i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item command="幼儿园">幼儿园</el-dropdown-item>
                        <el-dropdown-item command="小学阶段">小学阶段</el-dropdown-item>
                        <el-dropdown-item command="初中阶段">初中阶段</el-dropdown-item>
                        <el-dropdown-item command="初一">初一</el-dropdown-item>
                        <el-dropdown-item command="初二">初二</el-dropdown-item>
                        <el-dropdown-item command="初三">初三</el-dropdown-item>
                        <el-dropdown-item command="高中阶段">高中阶段</el-dropdown-item>
                        <el-dropdown-item command="高一">高一</el-dropdown-item>
                        <el-dropdown-item command="高二">高二</el-dropdown-item>
                        <el-dropdown-item command="高三">高三</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
        </el-form-item>
        <el-form-item label="人数/班" prop="coursepeople">
          <el-input type="number" v-model="form.coursepeople" min="1" placeholder="请输入学生人数" />
        </el-form-item>
        <el-form-item label="课时(分钟)" prop="coursetime">
          <el-input type="number" v-model="form.coursetime" placeholder="90分钟/节课" />
        </el-form-item>
        <el-form-item label="总课数(节)" prop="totalcourses">
          <el-input type="number" v-model="form.totalcourses" placeholder="10节课" />
        </el-form-item>
        <el-form-item label="开课时间" prop="starttime">
          <el-date-picker clearable
            v-model="form.starttime"
            type="date"
            format="yyyy 年 MM 月 dd 日"
            value-format="timestamp"
            placeholder="请输入课程开始时间"
            @change="TstartTime">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="结课时间" prop="endtime">
            <el-date-picker clearable
            v-model="form.endtime"
            type="date"
            format="yyyy 年 MM 月 dd 日"
            value-format="timestamp"
            placeholder="请输入课程结束时间"
            @change="TendTime">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="上课星期" prop="weekname">
                <el-dropdown trigger="click" @command="handleWeekStart">
                    <el-button type="primary">
                      {{ selectWeekStart }} <i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item v-for="item in week" :command="item">{{item}}</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
                至
                <el-dropdown trigger="click" @command="handleWeekEnd">
                    <el-button type="primary">
                      {{ selectWeekEnd }} <i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item v-for="item in week" :command="item">{{item}}</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
        </el-form-item>
        <el-form-item label="上课时间" prop="classtime">
              <el-time-picker
              is-range
              v-model="form.classtime"
              value-format="HH:mm:ss"
              range-separator="至"
              start-placeholder="开始时间"
              end-placeholder="结束时间"
              placeholder="选择时间范围"
              @change="changeClassTime"
              @blur="changeClassTime">
            </el-time-picker>
        </el-form-item>
        <el-form-item label="课程价格" prop="courseprice">
          <el-input v-model="form.courseprice" placeholder="请输入课程价格" />
        </el-form-item>
        <el-form-item label="状态" prop="coursestate">
          <el-input type="number" v-model="form.coursestate" placeholder="请输入状态:0 下架 1上架" />
        </el-form-item>
        <el-form-item label="逾期数">
          <el-input v-model="form.expiredday" placeholder="请输入课程多少天过期 0永不过期" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listCourses, getCourses, delCourses, addCourses, updateCourses } from "@/api/system/courses";
import axios from 'axios';
import { getToken } from '@/utils/auth'
export default {
  name: "Courses",
  data() {

    //自定规则
    var checkState = (rule, value, callback) => {
        if (value===null || value==='') {
              callback(new Error('请输入课程状态'));
        }
        // if (!Number.isInteger(value)) {
        //       callback(new Error('请输入数字值'));
        // }
        console.log(value !="0",value !=0,parseInt("-1"));
        if (parseInt(value)>1 || parseInt(value)<0) {
              callback(new Error('请输入0或者1'));
        }
        callback(); //放行
    }

    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 【请填写功能名称】表格数据
      coursesList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      selectLv:'基础班',
      selectObj:'选择对象',
      //本地上传  网络地址
      radio: '1',
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        firstclass: null,
        courselev: null,
        coursename: null,
        // courseins: null,
        // coursephotosList: null,
        // courseobj: null,
        // coursepeople: null,
        // coursetime: null,
        // totalcourses: null,
        // starttime: null,
        // endtime: null,
        // weekname: null,
        // classtime: null,
        // courseprice: null,
        // coursestate: null,
        // expiredday: null,
        // createtime: null
      },
      // 表单参数
      form: {
      },
      starttime:'',
      endtime:'',
      coursestate:'',
      weekname:'',
      classtime:'',
      coursepeople:'',
      coursetime:'',
      
      courseprice:'',
      courseins:'',
      coursename:'',
      firstclass:'',
      courselev:'',
      totalcourses:'',
      expiredday:'',
      // 表单校验
      backupList:[],
      //fileList: [
        // {name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}, 
        // {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}
      //],
      upload: {
        fileList: [],
        fileName: []
      },
      isTStartTime:false,
      isTEndTime:false,
      rules: {
          firstclass:[
            { required: true, message: "一级分类不能为空", trigger: "blur" }
          ],
          courselev: [
            { required: true, message: "二级分类不能为空", trigger: "blur" }
          ],
          coursename:[
            { required: true, message: "课程名称不能为空", trigger: "blur" }
          ],
          coursepeople: [
            { required: true, message: "请输入班人数", trigger: "blur" }
          ],
          coursetime:[
            { required: true, message: "请输入课时", trigger: "blur" }
          ],
          totalcourses:[
           { required: true, message: "请输入总课数", trigger: "blur" }
          ],
          starttime:[
            { required: true, message: "请输入开始时间", trigger: "blur" }
          ],
          endtime:[
            { required: true, message: "请输入结束时间", trigger: "blur" }
          ],
          weekname:[
            { required: true, message: "请选择上课星期", trigger: "blur" }
          ],
          classtime:[
            { required: true, message: "请选择上课时间", trigger: "blur" }
          ],
          courseobj:[
            { required: true, message: "请选择招生对象", trigger: "blur" }
          ],
          courseprice:[
            { required: true, message: "请输入课程价格", trigger: "blur" }
          ],
          coursestate:[
            { validator: checkState, trigger: 'blur' }
          ]  
          
      },
      selectCourse:'选择对象',
      objArr:["基础班","提升班","高级班"],
      week:["周一","周二","周三","周四","周五","周六","周日"],
      selectWeekStart:'选择星期',
      selectWeekEnd:"选择星期"
    };
  },
  created() {
    this.getList();
    //this.backupList=this.fileList;
  },
  methods: {
    showimg(imglist){
       let arr=[];
       if(imglist.indexOf(",")!=-1){
          arr=imglist.split(",");
       }else{
          console.log("imglist:",imglist);
          arr.push(imglist);
          console.log("imglist:",imglist);
       }
       return arr;
    },
    changeClassTime(e){
      console.log("选择上课时间II",e);
      if(e.length>=2){
        this.form.classtime=e[0]+"至"+e[1];
        console.log("上课时间:",this.form.classtime);
      }
    },
    TstartTime(){
        //console.log(this.form.starttime);
        //console.log(this.form.endtime===null);
        if(this.form.endtime!=null && this.form.starttime>this.form.endtime){
          this.$alert('开始时间不能比结束时间迟', '日期选择错误');
          this.isTStartTime=false;
        }
        this.isTStartTime=true;
    },
    TendTime(){
        console.log(this.form.endtime);
        if(this.form.endtime<this.form.starttime){
          this.$alert('结束时间不能比开始时间早', '日期选择错误');
          this.isTEndTime=false;
        }
        this.isTEndTime=true;
    },
    handleCommand(command){
       console.log("选择下拉菜单:",command);
       this.form.viplevel=command;
       this.selectLv=this.formatLv(command);   
    },
    handleZSCommand(command){
      console.log("选择招生对象:",command);
       this.selectObj=command;   
       this.form.courseobj=command; //招生对象
     },
    //选择星期开始
    handleWeekStart(command){
          this.selectWeekStart=command;
       if(this.selectWeekEnd==='选择星期'){
          this.selectWeekEnd=command;
       }
       if(this.selectWeekEnd!=null){
          this.form.weekname=this.selectWeekStart+" 至 "+this.selectWeekEnd;
          console.log("上课时间",this.form.weekname);
       }
    },
    //选择星期结束
    handleWeekEnd(command){
       this.selectWeekEnd=command;
       this.form.weekname=this.selectWeekStart+" 至 "+this.selectWeekEnd;
       console.log("上课时间",this.form.weekname);
    },
    selectRadio(e){
        console.log(e);
    },
    // 文件上传成功处理
    // handleFileSuccess(response, file, fileList) {
    //   console.log("文件上传成功处理",response);
    //   if(response.code===200){
    //     if(response.imglist.indexOf(",")!=-1){
    //       let imgurl=response.imglist.split(",");
    //       console.log(imgurl);
    //       console.log(imgurl.length);
    //       for(let i=0;i<imgurl.length;i++){
    //         let obj={};
    //         obj.name=imgurl[i].substring(imgurl[i].lastIndexOf("/")+1,imgurl[i].length);
    //         console.log("图片名称:",obj.name);
    //         obj.url=imgurl[i];
    //         this.fileList.push(obj);
    //       }
    //     }else{
    //       let imgurl=response.imglist;
    //       let obj={};
    //         obj.name=imgurl.substring(imgurl.lastIndexOf("/")+1,imgurl.length);
    //         console.log("图片名称:",obj.name);
    //         obj.url=imgurl;
    //         this.fileList.push(obj);
    //     }
    //     console.log("上传的文件:",this.fileList);
    //   }
    // },
    submitPics(dataid){
        // 创建新的数据对象
        let formData = new FormData();
        // 将上传的文件放到数据对象中
        this.upload.fileList.forEach(file => {
          console.log("循环文件:",file);
          formData.append('file', file.raw);
          this.upload.fileName.push(file.name);
        });
        console.log("提交前",formData.getAll('file'));
        // 文件名
        formData.append('fileName', this.upload.fileName);
        // 自定义上传
        //http://localhost:8080/common/OssUploadImage/
        axios.post(`https://ylhuashi.cn/common/OssUploadImage/`+dataid,formData,{headers:{Authorization:'Bearer ' + getToken()}}).then(res => {
          console.log("上传多图片成功",res);
          if(res.status===200){
            this.upload.fileList=[];
          }
        })
        .catch(error => {
            console.error("上传文件失败",error);
        });
    },
    // 上传发生变化钩子
    handleFileChange(file, fileList) {
      this.upload.fileList = fileList;
    },
    // 删除之前钩子
    handleFileRemove(file, fileList) {
      this.upload.fileList = fileList;
    },
    // handleRemove(file, fileList) {
    //   //console.log(file,"文件列表:",fileList);
    // },
    // handlePreview(file) {
    //   console.log(file);
    // },
    field101BeforeUpload(file) {
      let isRightSize = file.size / 1024 / 1024 < 2
      if (!isRightSize) {
        this.$message.error('文件大小超过 2MB')
      }
      return isRightSize
    },
    handleCommand(command){
       console.log("选择下拉菜单:",command);
       this.selectLv=command;    
    },
    handleCommandAdd(command){
       console.log("新增选项,选择下拉菜单:",command);
       this.selectCourse=command;
       this.form.courselev=command;    
    },
    /** 查询【课程】列表 */
    getList() {
      this.loading = true;
      listCourses(this.queryParams).then(response => {
        this.coursesList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        firstclass: null,
        courselev: null,
        coursename: null,
        courseins: null,
        coursephotosList: null,
        courseobj: null,
        coursepeople: null,
        coursetime: null,
        totalcourses: null,
        starttime: null,
        endtime: null,
        weekname: null,
        classtime: null,
        courseprice: null,
        coursestate: null,
        expiredday: null,
        createtime: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加【课程】";
      this.form.coursestate=1;  //0下架 1上架
      this.form.expiredday=0; //0 永不过期
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getCourses(id).then(response => {
        console.log("修改response.data==>",response.data);
        this.form = response.data;
        this.selectCourse=response.data.courselev;
        this.selectObj=response.data.courseobj;
        
        this.open = true;
        this.title = "修改【课程】";
        this.isTStartTime=true;
        this.isTEndTime=true;
      });
    },
    /** 提交按钮 */
    submitForm() {

      //上传图片
      // this.submitPics();
      // return;

      this.$refs["form"].validate(valid => {

        // console.log("添加表单信息:",this.form);
        // return;

        if (valid) {


          console.log("(this.form.courselev==>",this.form.courselev);
          console.log("(this.form.courseobj==>",this.form.courseobj);

          if(this.form.courselev==='' || this.form.courselev==='选择对象'){
            this.$alert('请选择【二级分类】', '二级分类错误');
            return;
          }

          if(this.form.courseobj==='' || this.form.courseobj==='选择对象'){
            this.$alert('请选择【招生对象】', '招生对象错误');
            return;
          }

          if(!this.isTStartTime){
            this.$alert('请检查【开课时间】', '开课日期错误');
            return;
          }

          if(!this.isTEndTime){
            this.$alert('请检查【结课时间】', '结课日期错误');
            return;
          }

          if (this.form.id != null) {
            updateCourses(this.form).then(response => {
                this.$modal.msgSuccess("修改成功");
                this.submitPics(this.form.id);
                this.open = false;
                this.getList();
            });
          } else {
            addCourses(this.form).then(response => {
                console.log("课程添加成功，返回id",response);
                this.$modal.msgSuccess("新增成功");
                //先上传课程其它信息成功后，再提交上传的图片
                if(response.dataid!=null){
                  this.submitPics(response.dataid); //根据id上传课程图片
                }
                this.open = false;
                this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除【课程】编号为"' + ids + '"的数据项？').then(function() {
        return delCourses(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/courses/export', {
        ...this.queryParams
      }, `courses_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
